<?php

namespace  Aitels\Foundation\Annotation;


class ListeningAnnotation extends Annotation implements AnnotationInterface
{
    public const NAME = 'listen';

    public function patten(): string
    {
        return '/@Listen\((.+)\)/';
    }

    public function processMatches(array $matches)
    {
        $allEvents = [];
        foreach ($matches[1] as $events) {
            $events=$this->extractToParts($events);
            foreach ($events as $event){
                $allEvents = array_merge($allEvents, explode(',', $event));
            }
        }
        return array_unique($allEvents);
    }
}